#include <stdio.h>
#include <string.h>

#include "BSP/USART/bsp_usart.h"

#if 1
#include <stdio.h>
#pragma import(__use_no_semihosting)             
                
struct __FILE 
{ 
	int handle; 
}; 

FILE __stdout;       
//define _sys_exit()
void _sys_exit(int x) 
{ 
	x = x; 
} 
#endif 

int fputc(int ch, FILE *f)
{
	while((USART1->SR & (1<<6)) == 0);
	
  USART1->DR = (uint8_t) ch;
  
	return ch;
}

void Uart_Putchar(uint8_t ch)
{
	while(!(USART1->SR & (1<<6)));
	
	USART1->DR = ch;
}

uint8_t Uart_Getchar(void)
{
	while(!(USART1->SR & (1<<5)));
	
	return USART1->DR;
}
